using System.ComponentModel.DataAnnotations;

namespace UniversalAdmin.Application.Dtos.Menu;

/// <summary>
/// 创建菜单数据传输对象
/// </summary>
public record CreateMenuDto
{
    /// <summary>
    /// 菜单名称
    /// </summary>
    [Required(ErrorMessage = "菜单名称不能为空")]
    [StringLength(50, ErrorMessage = "菜单名称长度不能超过50个字符")]
    public string Name { get; init; } = string.Empty;

    /// <summary>
    /// 菜单路径
    /// </summary>
    [StringLength(200, ErrorMessage = "菜单路径长度不能超过200个字符")]
    public string? Path { get; init; }

    /// <summary>
    /// 菜单图标
    /// </summary>
    [StringLength(50, ErrorMessage = "菜单图标长度不能超过50个字符")]
    public string? Icon { get; init; }

    /// <summary>
    /// 父级菜单ID
    /// </summary>
    public Guid? ParentId { get; init; }

    /// <summary>
    /// 排序号
    /// </summary>
    [Range(0, int.MaxValue, ErrorMessage = "排序号必须大于等于0")]
    public int Sort { get; init; } = 0;

    /// <summary>
    /// 菜单编码（可选，不填则自动生成）
    /// </summary>
    [StringLength(20, ErrorMessage = "菜单编码长度不能超过20个字符")]
    public string? Code { get; init; }

    /// <summary>
    /// 菜单描述
    /// </summary>
    [StringLength(200, ErrorMessage = "菜单描述长度不能超过200个字符")]
    public string? Description { get; init; }
}
